<!DOCTYPE html>
<html lang="zh-cn">

<head>
	<meta charset="UTF-8">
	<title>entry page</title>
	<script src="marked.min.js"></script>

	<script>
		var daylogurl = "https://hyg.codeberg.page/blog/@master/release/time/d." + datestr() + ".md";


		window.onload = function () {
			getTextFileFromURL("./term/t1.yaml");
		}


		function getTextFileFromURL(url) {
			var xmlhttp = new XMLHttpRequest();
			xmlhttp.onreadystatechange = function () {
				alert(xmlhttp.readyState);
				alert(xmlhttp.status);
				alert(xmlhttp.responseText);
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					var text = xmlhttp.responseText;
					document.getElementById('daylog').innerHTML = text;
				}
			};
			xmlhttp.open("GET", url, true);
			xmlhttp.send();
		}

		function datestr(diff = 0) {
			var theDate = new Date();
			theDate.setDate(theDate.getDate() + diff);

			var year = theDate.getFullYear();
			var month = theDate.getMonth() + 1 < 10 ? "0" + (theDate.getMonth() + 1) : theDate.getMonth() + 1;
			var day = theDate.getDate() < 10 ? "0" + theDate.getDate() : theDate.getDate();
			var dateStr = year + "" + month + "" + day;

			return dateStr;
		}
	</script>
</head>

<body>
	<div id="daylog"></div>
</body>

</html>